home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_05
/
8n05049a
< prev
next >
Wrap
Text File
|
1990-04-17
|
863b
|
48 lines
*****Listing 2*****
typedef int truth;
const truth forever = 1;
class Editor {
public:
Editor( char *fname) : b( fname),
input(fname), output( "", "w")
{
filename = new char[strlen( fname) + 1];
strcpy( filename, fname);
rp = ®
}
void eval()
{
while( forever)
(this->*action[input.get()])();
}
void go() { rp->go( b, output); }
void print() { rp->print( b, output); }
void insert() { rp->insert( b, input); }
void del() { rp->del( b, kbuf, output); }
void put() { rp->put( b, kbuf); }
void quit() { exit(0); }
void eerror() { output.put( "?\n"); } // error function
void donothing() {}
private:
Buffer b;
File input;
File output;
Register Editor::*rp;
Register reg;
Iregister ireg;
Buffer kbuf; // kill buffer
};